package com.luoqiu.entities;

import lombok.Data;

/**
 * @author 洛秋y
 * @date 2020/11/9 13:03
 */
@Data
public class Result<T> {
    private Integer code;
    private String msg;
    private T data;

    public static<T> Result<T> success(T data) {
        Result<T> result = new Result<>();
        result.setCode(200);
        result.setMsg("success");
        result.setData(data);
        return result;
    }

    public static<T> Result<T> fail(T data) {
        Result<T> result = new Result<>();
        result.setCode(400);
        result.setMsg("fail");
        result.setData(data);
        return result;
    }
}
